<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.ResultSet" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/3/26
  Time: 8:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>out对象</title>
</head>
<body>
<%
    Class.forName("com.mysql.jdbc.Driver");
    Connection conn= DriverManager.getConnection("jdbc:mysql://localhost:3306/1613580002","root","tjxwq42222");
    Statement stmt=conn.createStatement();
    ResultSet rs=stmt.executeQuery("select * from t_news");
%>
<table bgcolor="#9999dd" border="1" width="400px">
        <%
        while(rs.next())
        {
            out.println("<tr>");
            out.println("<td>");
            out.println(rs.getString(1));
            out.println("</td>");
            out.println("<td>");
            out.println(rs.getString(2));
            out.println("</td>");
            out.println("</tr>");
        }
    %>
            <h2>Hello 田俊秀!</h2>
</body>
</html>
